﻿#region Copyright
// 
// Copyright (C) 2010 VirtualStaticVoid <virtualstaticvoid@gmail.com>
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
#endregion

namespace IoCWrap
{
  public class TestRegistry : IRegistry
  {

    public void Configure(IContainerBuilder builder)
    {

      builder.Register<Instance>()
        .As<IInstance>()
        .FactoryScoped();

      builder.Register<SingleInstance>()
        .As<ISingleInstance>()
        .SingletonScoped();

      builder.Register<NamedInstance>()
        .Named<INamedInstance>("NamedInstance")
        .FactoryScoped();

      builder.Register<NamedSingleInstance>()
        .Named<INamedSingleInstance>("NamedSingleInstance")
        .SingletonScoped();

      builder.Register<ICustomService>(c => new CustomService())
        .FactoryScoped();

    }
  }

  public interface IInstance { }
  public class Instance : IInstance { }

  public interface ISingleInstance { }
  public class SingleInstance : ISingleInstance { }

  public interface INamedInstance { }
  public class NamedInstance : INamedInstance { }

  public interface INamedSingleInstance { }
  public class NamedSingleInstance : INamedSingleInstance { }

  public interface ICustomService { }
  public class CustomService : ICustomService { }

}
